﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace Presentation
{
    public partial class TagControl : UserControl
    {
        private string tagText;
        private TagBox tagBox;

        public string TagText
        {
            get { return tagText; }
            set { tagText = value; }
        }
        
        public TagBox TagBox
        {
            get { return tagBox; }
            set { tagBox = value; }
        }

        public TagControl()
        {
            InitializeComponent();
        }

        public TagControl(string _tagText)
        {
            tagText = _tagText;
            InitializeComponent();
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            ControlPaint.DrawBorder(e.Graphics, base.ClientRectangle, Color.FromArgb(187, 216, 251), ButtonBorderStyle.Solid);

            labelTag.Text = tagText;
        }

        private void buttonCloseTag_Click(object sender, EventArgs e)
        {
            TagBox.Tags.Remove(this);
            Dispose(true);
        }

        private void TagControl_MouseHover(object sender, EventArgs e)
        {
            BackColor = Color.FromArgb(233, 237, 243);
        }

        private void TagControl_MouseLeave(object sender, EventArgs e)
        {
            BackColor = Color.FromArgb(243, 247, 253);
        }
    }
}